package com.mhc.suzuki.manager.impl;

import com.mhc.suzuki.dal.mapper.ext.OrderExtMapper;
import com.mhc.suzuki.dal.model.OrderDO;
import com.mhc.suzuki.dal.query.OrderQuery;
import com.mhc.suzuki.manager.OrderManager;
import com.mhc.suzuki.vo.OrderVO;
import com.subaru.common.query.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;


/**
 * Manager for Order.
 */

@Component
public class OrderManagerImpl implements OrderManager {


    @Autowired
    protected OrderExtMapper orderExtMapper;

    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(OrderQuery query) {
        return orderExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(OrderQuery query) {
        return orderExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(OrderDO record) {
        return orderExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(OrderDO record) {
        return orderExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<OrderDO> selectByQuery(OrderQuery query) {
        return orderExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
     */
    @Override
    public PageResult<OrderDO> selectByQueryWithPage(OrderQuery query) {
        PageResult<OrderDO> result = new PageResult<OrderDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    @Override
    public PageResult<OrderVO> selectListByQueryWithPage(Map<String, ?> paramMap) {
        PageResult<OrderVO> result = new PageResult<OrderVO>();
        result.setTotalCount(this.countListByQuery(paramMap));
        result.setResult(this.selectListByQuery(paramMap));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public OrderDO selectByPrimaryKey(Long id) {
        return orderExtMapper.selectByPrimaryKey(id);
    }

    /**
     * select by order no.
     */
    @Override
    public OrderDO selectByOrderNo(String orderNo) {
        return orderExtMapper.selectByOrderNo(orderNo);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective(OrderDO record, OrderQuery query) {
        return orderExtMapper.updateByQuerySelective(record, query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery(OrderDO record, OrderQuery query) {

        return orderExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(OrderDO record) {
        return orderExtMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public List<OrderVO> selectListByQuery(Map<String, ?> paramMap) {
        return orderExtMapper.selectListByQuery(paramMap);
    }

    @Override
    public int countListByQuery(Map<String, ?> paramMap) {
        return orderExtMapper.countListByQuery(paramMap);
    }
}
